<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>添加字典</title>
  <link rel="stylesheet" th:href="@{/layui-v2.6.8/css/layui.css}" href="/static/layui-v2.6.8/css/layui.css">
</head>
<body>
<div style="padding: 15px;">
  <form class="layui-form form-position" action="/amin/dict/createDict" method="post" id="dict-from-data">
    <div class="layui-form-item">
      <label class="layui-form-label">字典标签</label>
      <div class="layui-input-block">
        <input type="text" name="dictName" th:field="${dict.dictTitle}" required  lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input layui-input-width">
        <input type="text" name="id" th:field="${dict.id}" style="display: none"   placeholder="请输入" autocomplete="off" class="layui-input layui-input-width">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">字典键值</label>
      <div class="layui-input-block">
        <input type="text" name="dictKey" th:field="${dict.dictKey}"  required  lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input layui-input-width">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">字典类型</label>
      <div class="layui-input-block">
        <input type="text" name="dictType" th:field="${dict.dictType}"  required  lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input layui-input-width">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">样式属性</label>
      <div class="layui-input-block">
        <input type="text" name="dictStyle" th:field="${dict.dictStyle}"  placeholder="请输入" autocomplete="off" class="layui-input layui-input-width">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">回显样式</label>
      <div class="layui-input-block">
        <input type="text" name="echoStyle" th:field="${dict.echoStyle}"  placeholder="请输入" autocomplete="off" class="layui-input layui-input-width">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">系统默认</label>
      <div class="layui-input-block">
        <!--<input type="radio" name="systemDefault" required  lay-verify="required" th:field="${dict.systemDefault}" value="0" title="是" checked="">
        <input type="radio" name="systemDefault" required  lay-verify="required" th:field="${dict.systemDefault}" value="1" title="否">-->
        <input type="radio" name="systemDefault" th:each="systemDefault,systemDefaultStat:${systemYseNo}"  required  lay-verify="required" th:field="${dict.systemDefault}" th:value="${systemDefault.dictKey}" th:title="${systemDefault.dictTitle}" checked="">

      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">状态</label>
      <div class="layui-input-block">
        <input type="radio" name="dictState" th:each="dictState,dictStateStat:${systemSwitchType}"  required  lay-verify="required" th:field="${dict.dictState}" th:value="${dictState.dictKey}" th:title="${dictState.dictTitle}" checked="">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">排序</label>
      <div class="layui-input-block">
        <input type="text" name="sort" th:field="${dict.sort}" required  lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input layui-input-width">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">备注</label>
      <div class="layui-input-block">
        <input type="text" name="remarks" th:field="${dict.remarks}" required  lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input layui-input-width">
      </div>
    </div>
    <div class="layui-form-item">
      <div class="layui-input-block">
        <button class="layui-btn" id="form_submit_button_01" lay-submit lay-filter="formSubmit">保存</button>
        <button type="reset" th:if="${dict.id == null}" class="layui-btn layui-btn-primary">重置</button>
      </div>
    </div>

  </form>
</div>
</body>
<!-- 引入 layui.js -->
<script th:src="@{/layui-v2.6.8/layui.js}" src="/static/layui-v2.6.8/layui.js"></script>
<script th:src="@{/jquery-3.5.1/jquery-3.5.1.min.js}" src="/static/jquery-3.5.1/jquery-3.5.1.min.js"></script>
<script th:src="@{/ajaxSubmit.js}" src="/static/jquery-3.5.1/jquery-3.5.1.min.js"></script>

<script>
  layui.use(function(){
    var layer = layui.layer
            ,form = layui.form;
    //监听提交
    form.on('submit(formSubmit)', function(data){
      $("#form_submit_button_01").attr('disabled',false);
      var url = '/amin/dictList/dataSubmit';
      var data =$("#dict-from-data").serialize();
      layer.msg('操作成功，正在跳转......');
      ajaxSubmit(url,data,"","");
      var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
      parent.location.reload();
      parent.layer.close(index);
    });
  });
</script>
</html>